#ifndef WORDFRAME_H
#define WORDFRAME_H

#include <QFrame>

namespace Ui {
class WordFrame;
}

class MdxEngin;
class LookupWidget;
class QHotkey;
class SearchOverlay;
class DynamicBackgroundInterface;

class WordFrame : public QFrame {
    Q_OBJECT

public:
    explicit WordFrame(QWidget* parent = nullptr);
    ~WordFrame();

private:
    void genWord();
    QString next();
    void updateDicts();
    void initDicts();
    void initCoca();
    void initCsh();
    void getUnknownWord(const QString& file);

private:
    void genRandVector(QVector<QString>& vs);

private:
    Ui::WordFrame* ui;
    MdxEngin* m_mdxEngin = nullptr;
    QTimer* m_enTimer;
    LookupWidget* m_lookup;
    QVector<QString> m_cocas;
    int m_idx = 0;
    QHotkey* m_popupHotkey = nullptr;
    SearchOverlay* m_overlay = nullptr;
    QVector<QString> m_L1, m_L2, m_L3;
    int m_tidL1, m_tidL2, m_tidL3;

    // QObject interface
protected:
    void timerEvent(QTimerEvent* event);
    void paintEvent(QPaintEvent* event);

private:
    DynamicBackgroundInterface *dm_bg;
};

#endif  // WORDFRAME_H
